//表单验证
function validate_form() {
    const form = $("#login_form");
    const data = form.serialize();
    var index = layer.open({
        type: 3,
        icon: 1,
        shade: [0.3, '#000']
    });

    $.ajax({
        type: "post",
        url: "loginCheck",
        data: data,
        success: function (res) {
            if (res.code == 200) {
                //返回上一页并刷新
                Cookie.set("user", JSON.stringify(res.data), 1);
                location.href = contextPath || "/";
            } else {
                layer.msg(res.msg);
            }
            layer.close(index);
        },
        error: function (err) {
            layer.msg("错误," + err.status);
            layer.close(index)
        }
    });
    return false;
}